// 一个状态模块就是一个 reducer
const reducer = (state = {
    count: 100
}, actions)=>{
    const {type, payload} = actions

    switch (type) {
        case 'add':
            return {...state, count: state.count + 1}
        case 'reduce':
            return {...state, count: state.count - 1}
        case 'addNum':
            return {...state, count: state.count + payload}
        case 'reduceNum':
            return {...state, count: state.count - payload}
        default:
            return state
    }
}

export default reducer